#ifndef _LIST_H
#define _LIST_H

typedef struct {
    int   id;
    char  name[200];
    float price;
    int   type;
}merchandise_t;
typedef merchandise_t value_t;

typedef int (*search_fun_t)(value_t val, void* pattern);

typedef struct _list_t{
    struct _list_t* next;
    value_t value;
}List_t;

int list_add(List_t* list, value_t val);
int list_del(List_t* list, int id);
int list_modify(List_t* list, int id, value_t new_val);
int list_search(List_t* list, search_fun_t func, void* pattern, value_t* val);
int list_traverse(List_t* list, value_t* val, int op);
int list_update(List_t* list, int index, value_t new_val);

#endif
